package net.core.base.dao;

import java.util.HashMap;
import java.util.List;

import org.apache.commons.logging.Log;

public interface CommonDAO {

	/**
	 * 
	 * Description: 获得分页内容
	 * 
	 * @Title: getPageList
	 * @param sql
	 *            sql语句
	 * @param pageSize
	 *            每页大小
	 * @param pn
	 *            页号
	 * @return List<HashMap>
	 * @author zyfine
	 * @throws Exception
	 * @date Jun 13, 2010
	 * 
	 */
	List<HashMap> getPageList(String sql, int pageSize, int pn);

	/**
	 * 
	 * Description: 获得分页大小
	 * 
	 * @Title: getPageNum
	 * @param sql
	 * @return
	 * @throws Exception
	 *             int
	 * @author zyfine
	 * @date Sep 7, 2010
	 * 
	 */
	int getPageNum(String sql);

	/**
	 * 
	 * Description: 获得记录通过sql
	 * 
	 * @Title: getDataList
	 * @param sql
	 * @return List<HashMap>
	 * @author zyfine
	 * @date Jun 13, 2010
	 * 
	 */
	List<HashMap> getDataList(String sql);

	/**
	 * 
	 * Description: 通过recid,tableName查询记录信息
	 * 
	 * @Title: getInforByRecId
	 * @return HashMap
	 * @author zyfine
	 * @date Jun 28, 2010
	 * 
	 */
	HashMap getInforByRecId(String tableName, String recId);

	/**
	 * 插入数据 参数：sql 返回 int
	 * 
	 * @Title: insertSql
	 * @param sql
	 * @return
	 * @throws Exception
	 * @return int
	 * @description
	 * @version 1.0
	 * @author xiaowei
	 * @update 2012-8-5 下午03:40:23
	 */
	public int insertSql(String sql);

	/**
	 * 
	 * Description: 修改语句
	 * 
	 * @Title: updateSql
	 * @param sql
	 * @return int
	 * @author zyfine
	 * @date Jun 29, 2010
	 * 
	 */
	int updateSql(String sql);

	/**
	 * 数据 参数：sql 返回 int
	 * 
	 * @Title: deleteDataReal
	 * @param sql
	 * @return
	 * @throws Exception
	 * @return int
	 * @description
	 * @version 1.0
	 * @author xiaowei
	 * @update 2012-8-5 下午03:42:03
	 */
	public int deleteDataReal(String sql);
	public int deleteDataReal(String tableName, String rec[]);

	/**
	 * 
	 * Description: 通过sql删除记录伪
	 * 
	 * @Title: deleteData
	 * @param tableName
	 * @param rec
	 * @return int
	 * @author zyfine
	 * @date Jun 24, 2010
	 * 
	 */
	int deleteData(String tableName, String rec, String user);
	int deleteData(String tableName, String rec[], String user);

	/**
	 * 
	 * Description: 直接执行sql
	 * 
	 * @Title: runSql
	 * @param sql
	 *            void
	 * @author zyfine
	 * @date Aug 26, 2010
	 * 
	 */
	int runSql(String sql);
	
	/**
	 * 批量insert
	 * @Title: batchInsert
	 * @param list
	 * @return void
	 * @description 
	 * @version 1.0
	 * @author xiaowei
	 * @update Sep 26, 2012 1:36:57 PM
	 */
	public int batchInsert(List list,Log logger);
	
	/*批量执行update*/
	public int batchUpdate(List list,Log logger);
	
	/*批量执行sql update insert delete 混合*/
	public int batchRunSql(List list,Log logger);
	/**
	 * 获取序列值
	 * @param seqName
	 * @return
	 */
	public long getSeqNum(String seqName);

}
